package com.java.zhuiyun.api.fuzzy_query.controller;

import com.java.zhuiyun.api.fuzzy_query.service.FuzzyQueryService;
import com.java.zhuiyun.common.response.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName FuzzyQueryController
 * @Description TODO PC首页模糊查询
 * @Author WX
 * @Date 2023/8/24 16:27
 **/
@RestController
@RequestMapping("fuzzyQuery")
@CrossOrigin
public class FuzzyQueryController {
    @Autowired
    private FuzzyQueryService fuzzyQueryService;

    /*
    * @Author WX
    * @Description 通过值查询
    * @Date 2023/8/24 16:31
    * @Return
    * @param searchValue
    */
    @RequestMapping("/makeBackendRequestValue")
    public CommonResult makeBackendRequestValue (String searchValue) {
        return CommonResult.ok( fuzzyQueryService.makeBackendRequestValue(searchValue));
    }

    /*
    * @Author WX
    * @Description 通过id查询
    * @Date 2023/8/24 16:31
    * @Return
    * @param tiaoId
    */
    @RequestMapping("/makeBackendRequestTiaoId")
    public CommonResult makeBackendRequestTiaoId (Integer tiaoId) {
        return CommonResult.ok( fuzzyQueryService.makeBackendRequestTiaoId(tiaoId));
    }

    /*
    * @Author WX
    * @Description 查询字典表对应的分类名称
    * @Date 2023/8/24 21:21
    * @Return
    * @param tiaoId
    */
    @RequestMapping("/makeQueryDict")
    public CommonResult makeQueryDict (Integer tiaoId) {
        return CommonResult.ok( fuzzyQueryService.makeQueryDict(tiaoId));
    }
}
